package com.itheima02;

public class Tsest03 {
    public static void main(String[] args) {
        try {
            int n1 = getMax(null);
        } catch (Exception e) {
           // e.printStackTrace();
        }

        int[] arr = new int[0];
        try {
            int n2 = getMax(arr);
        } catch (Exception e) {
           // e.printStackTrace();
        }

        int[] arr2 = {1, 2, 4, 24, 32, 5324, 32};
        try {
            int n3 = getMax(arr2);
        } catch (Exception e) {
           // e.printStackTrace();
        }
        System.out.println("程序继续执行");
    }

    public static int getMax(int[] args) throws NullPointerException,IndexOutOfBoundsException{
        int max = args[0];
        for (int i = 1; i < args.length; i++) {
            if (max < args[i]) {
                max = args[i];
            }
        }
        return max;
    }
}
